import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
      // 首页
      {
        path: '/',
        name: 'Home',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          isLogin: true,
          isFooter: true
        }
      },

      // 通讯录
      {
        path: '/addressBook',
        name: 'AddressBook',
        component: () => import('@/views/AddressBook/index.vue'),
        meta: {
          isLogin: true,
          isFooter: true
        }
      },

      // 发现
      {
        path: '/discover',
        name: 'Discover',
        component: () => import('@/views/Discover/index.vue'),
        meta: {
          isLogin: true,
          isFooter: true
        }
      },

      // 我的
      {
        path: '/me',
        name: 'Me',
        component: () => import('@/views/Me/index.vue'),
        meta: {
          isLogin: true,
          isFooter: true
        }
      },

      // 聊天
      {
        path: '/chat',
        name: 'Chat',
        component: () => import('@/views/Chat/index.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 用户注册
      {
        path: '/register',
        name: 'Register',
        component: () => import('@/views/Register/index.vue'),
        meta: {
          isLogin: false,
          isFooter: true
        }
      },

      // 找回密码
      {
        path: '/forgotPassword',
        name: 'ForgotPassword',
        component: () => import('@/views/ForgotPassword/index.vue'),
        meta: {
          isLogin: false,
          isFooter: true
        }
      },

      // 密码登录
      {
        path: '/passwordLogin',
        name: 'PasswordLogin',
        component: () => import('@/views/Login/passwordLogin.vue'),
        meta: {
          isLogin: false,
          isFooter: false
        }
      },

      // 短信登录
      {
        path: '/messageLogin',
        name: 'MessageLogin',
        component: () => import('@/views/Login/messageLogin.vue'),
        meta: {
          isLogin: false,
          isFooter: false
        }
      },


      // 个人设置
      {
        path: '/userSet',
        name: 'UserSet',
        component: () => import('@/views/UserSet/index.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 其他信息
      {
        path: '/otherInfo',
        name: 'OtherInfo',
        component: () => import('@/views/UserSet/otherInfo.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 修改昵称
      {
        path: '/editNick',
        name: 'EditNick',
        component: () => import('@/views/UserSet/editNick.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 修改地区
      {
        path: '/editRegion',
        name: 'EditRegion',
        component: () => import('@/views/UserSet/editRegion.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 修改手机号
      {
        path: '/editMobile',
        name: 'EditMobile',
        component: () => import('@/views/UserSet/editMobile.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 修改邮箱
      {
        path: '/editEmail',
        name: 'EditEmail',
        component: () => import('@/views/UserSet/editEmail.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 修改密码
      {
        path: '/changePassword',
        name: 'ChangePassword',
        component: () => import('@/views/UserSet/changePassword.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 群聊
      {
        path: '/groupChat',
        name: 'GroupChat',
        component: () => import('@/views/GroupChat/index.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 发起群聊
      {
        path: '/startGroupChat',
        name: 'StartGroupChat',
        component: () => import('@/views/GroupChat/start.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 选择群聊
      {
        path: '/selectGroupChat',
        name: 'SelectGroupChat',
        component: () => import('@/views/GroupChat/select.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 添加好友
      {
        path: '/addFriend',
        name: 'AddFriend',
        component: () => import('@/views/Friend/add.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 好友详情
      {
        path: '/friendDetail',
        name: 'FriendDetail',
        component: () => import('@/views/Friend/detail.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 好友更多信息
      {
        path: '/friendMoreInfo',
        name: 'FriendMoreInfo',
        component: () => import('@/views/Friend/moreInfo.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 聊天信息
      {
        path: '/chatInfo',
        name: 'ChatInfo',
        component: () => import('@/views/Chat/info.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 申请添加好友
      {
        path: '/applyFriend',
        name: 'ApplyFriend',
        component: () => import('@/views/Friend/apply.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 待添加好友
      {
        path: '/waitAdd',
        name: 'WaitAdd',
        component: () => import('@/views/Friend/waitAdd.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 资料设置
      {
        path: '/setInformation',
        name: 'SetInformation',
        component: () => import('@/views/Friend/setInformation.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 设置备注和标签
      {
        path: '/setLabel',
        name: 'SetLabel',
        component: () => import('@/views/Friend/setLabel.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 聊天记录
      {
        path: '/record',
        name: 'Record',
        component: () => import('@/views/Chat/record.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 新的好友
      {
        path: '/newFriend',
        name: 'NewFriend',
        component: () => import('@/views/Friend/new.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 仅聊天好友
      {
        path: '/onlyChatFriend',
        name: 'OnlyChatFriend',
        component: () => import('@/views/Friend/onlyChat.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 选择联系人
      {
        path: '/contact',
        name: 'Contact',
        component: () => import('@/views/Friend/contact.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 黑名单
      {
        path: '/blacklist',
        name: 'Blacklist',
        component: () => import('@/views/Friend/blacklist.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 通讯录标签
      {
        path: '/label',
        name: 'Label',
        component: () => import('@/views/AddressBook/label.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 搜索
      {
        path: '/search',
        name: 'Search',
        component: () => import('@/views/Search/index.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 通知
      {
        path: '/notify',
        name: 'Notify',
        component: () => import('@/views/Notify/index.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 群聊公告
      {
        path: '/notice',
        name: 'Notice',
        component: () => import('@/views/GroupChat/notice.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 群聊成员
      {
        path: '/member',
        name: 'Member',
        component: () => import('@/views/GroupChat/member.vue'),
        meta: {
          isLogin: true,
          isFooter: false
        }
      },

      // 扫一扫
      {
        path: '/scanner',
        name: 'Scanner',
        component: () => import('@/views/Scanner/index.vue'),
        meta: {
          isLogin: false,
          isFooter: false
        }
      },

      // 定位案例
      {
        path: '/locate',
        name: 'Locate',
        component: () => import('@/views/Locate/index.vue'),
        meta: {
          isLogin: false,
          isFooter: false
        }
      }
    ],
    // 路由滚动行为
    scrollBehavior (to, from, savedPosition) {
      return {
        top: 0
      }
    }
  })
  
  export default router